package com.company;

public class Main {

    public static void main(String[] args) {
	// write your code here

        // 创建一个Employee的数组，然后创建不同的Employee对象
        // 打印某月份这些不同类型的员工的月工资

        // 创建员工1
        SalariedEmployee employee
                = new SalariedEmployee();
        employee.setMonthSalary(3000);
        employee.setMonth(4);
        employee.setName("TOM");
        // 创建员工2
        HourlyEmployee hourlyEmployee
                = new HourlyEmployee();
        hourlyEmployee.setHours(170);
        hourlyEmployee.setHourSalary(15);
        hourlyEmployee.setName("JACK");
        hourlyEmployee.setMonth(5);

        SalesEmployee salesEmployee = new SalesEmployee();
        salesEmployee.setName("张三");
        salesEmployee.setMonth(5);
        salesEmployee.setMonthSales(100000);
        salesEmployee.setPercent(0.2f);

        BasePlusSalesEmployee basePlusSalesEmployee = new BasePlusSalesEmployee();
        basePlusSalesEmployee.setName("李四");
        basePlusSalesEmployee.setMonth(5);
        basePlusSalesEmployee.setBaseSalary(1200);
        basePlusSalesEmployee.setPercent(0.15f);
        basePlusSalesEmployee.setMonthSales(100000);



        Employee[] employees = {employee,hourlyEmployee,salesEmployee,basePlusSalesEmployee};

        int month = 5; //设置当前月份

        for (int i = 0; i < employees.length; i++) {
            // 打印输出数组中每一个员工的单月工资、
            // 张三 5月工资 是 ###元
            System.out.println(employees[i].getName()
                    + month+"月份的工资是："
                    +employees[i].getSalary(month)+"元");
        }

    }
}
